package com.ruoyi.project.wms.service.impl;

import java.util.List;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.common.zx.PageData;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.wms.mapper.WmsGoodsStockLogMapper;

/**
 * 出入库记录Service业务层处理
 *
 * @author zx
 * @date 2023-06-16
 */
@Service
public class WmsGoodsStockLogServiceImpl extends BaseController{
    @Autowired
    private WmsGoodsStockLogMapper wmsGoodsStockLogMapper;

    /**
     * 查询出入库记录
     *
     * @param id 出入库记录主键
     * @return pd
     */

    public PageData selectWmsGoodsStockLogById(Long id){
        return wmsGoodsStockLogMapper.selectWmsGoodsStockLogById(id);
    }

    /**
     * 查询出入库记录列表
     *
     * @param pd
     * @return 出入库记录
     */

    public List<PageData> selectWmsGoodsStockLogList(PageData pd){
        pd.put("tenant_id",this.getUserTenantId());
        return wmsGoodsStockLogMapper.selectWmsGoodsStockLogList(pd);
    }

    /**
     * 新增出入库记录
     *
     * @param pd 出入库记录
     * @return 结果
     */
    public int insertWmsGoodsStockLog(PageData pd){
        pd.put("tenant_id",this.getUserTenantId());
        pd.put("update_by",this.getUsername());
        pd.put("update_time",DateUtils.getTime());
        pd.put("create_by",this.getUsername());
        pd.put("create_time",DateUtils.getTime());
        return wmsGoodsStockLogMapper.insertWmsGoodsStockLog(pd);
    }

    /**
     * 修改出入库记录
     *
     * @param pd 出入库记录
     * @return 结果
     */
    public int updateWmsGoodsStockLog(PageData pd){
        pd.put("update_by",this.getUsername());
        pd.put("update_time",DateUtils.getTime());
        return wmsGoodsStockLogMapper.updateWmsGoodsStockLog(pd);
    }

    /**
     * 批量删除出入库记录
     *
     * @param ids 需要删除的出入库记录主键
     * @return 结果
     */
    public int deleteWmsGoodsStockLogByIds(Long[] ids)
    {
        return wmsGoodsStockLogMapper.deleteWmsGoodsStockLogByIds(ids);
    }

    /**
     * 删除出入库记录信息
     *
     * @param id 出入库记录主键
     * @return 结果
     */
    public int deleteWmsGoodsStockLogById(Long id){
        return wmsGoodsStockLogMapper.deleteWmsGoodsStockLogById(id);
    }
}
